package javolution.context;

import javolution.lang.Configurable;

/* loaded from: classes2.dex */
public abstract class AllocatorContext extends Context {
    private static volatile AllocatorContext _Default = new HeapContext();
    public static final Configurable<Class<? extends AllocatorContext>> DEFAULT = new Configurable(_Default.getClass()) { // from class: javolution.context.AllocatorContext.1
        @Override // javolution.lang.Configurable
        protected void notifyChange() {
            AllocatorContext unused = AllocatorContext._Default = (AllocatorContext) ObjectFactory.getInstance((Class) get()).object();
        }
    };

    /* loaded from: classes2.dex */
    public static class Reference<T> implements javolution.lang.Reference<T> {
        private static final ObjectFactory FACTORY = new ObjectFactory() { // from class: javolution.context.AllocatorContext.Reference.1
            @Override // javolution.context.ObjectFactory
            protected void cleanup(Object obj) {
                ((Reference) obj)._value = null;
            }

            @Override // javolution.context.ObjectFactory
            protected Object create() {
                return new Reference();
            }
        };
        private T _value;

        public static <T> Reference<T> newInstance() {
            return (Reference) FACTORY.object();
        }

        @Override // javolution.lang.Reference
        public final T get() {
            return this._value;
        }

        @Override // javolution.lang.Reference
        public final void set(T t) {
            this._value = t;
        }

        public String toString() {
            return String.valueOf(this._value);
        }
    }

    public static AllocatorContext getCurrent() {
        return Context.getCurrent().getAllocatorContext();
    }

    public static AllocatorContext getDefault() {
        return _Default;
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public abstract void deactivate();

    /* JADX INFO: Access modifiers changed from: protected */
    public abstract Allocator getAllocator(ObjectFactory objectFactory);
}
